package com.small.admin.entity;

import com.small.common.util.val.group.ValAdd;
import com.small.common.util.val.group.ValUpdate;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * 作者: fenny
 * 邮箱: 893146555@qq.com
 * 时间: 2017-10-17 15:28:29
 * 描述: 系统菜单
 */
@Data
@Table(name = "t_menu")
public class Menu implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @NotNull(groups = {ValUpdate.class})
    private Long id;

    //父栏目ID
    @NotNull(groups = {ValAdd.class})
    @Column(name = "parent_id")
    private Long parentId;

    //栏目链接地址
    @Column(name = "url")
    private String url;

    //请求方法,get、post、put等
    @Column(name = "method")
    private String method;

    //菜单小图标
    @Length(max = 30, groups = {ValAdd.class, ValUpdate.class})
    @Column(name = "icon")
    private String icon;

    //栏目名称
    @NotNull(groups = {ValAdd.class})
    @Length(max = 30, groups = {ValAdd.class, ValUpdate.class})
    @Column(name = "name")
    private String name;

    //描述
    @Length(max = 200, groups = {ValAdd.class, ValUpdate.class})
    @Column(name = "description")
    private String description;

    //排序值
    @Column(name = "orderline")
    private Long orderline;

    //状态，0关闭1打开
    @Min(value = 0, groups = {ValAdd.class, ValUpdate.class})
    @Max(value = 1, groups = {ValAdd.class, ValUpdate.class})
    @Column(name = "state")
    private Integer state;

    @Column(name = "cid")
    private Long cid;

    @Column(name = "ctime")
    private Long ctime;

    @Column(name = "uid")
    private Long uid;

    @Column(name = "utime")
    private Long utime;

}
